#ifndef DW_GRAPHICS_TEXTUREMANAGER_H
#	define DW_GRAPHICS_TEXTUREMANAGER_H

#include "base/singleton.h"

namespace dw {
	namespace graphics {

class ITexture;

class TextureManager : public dw::base::Singleton< TextureManager >
{
public:

	void setRootPath(const std::string& path) { _rootPath = path; }

	ITexture* getTexture(const std::string& filename);

	/// Load texture
	ITexture* loadTexture(const std::string& filename);
	/// Unload texture by name
	void unloadTexture(const std::string& filename);

	/// Unload all managed textures
	void unloadAll();

private:

	typedef std::map<std::string, ITexture*>	TextureNameMap;
	
	typedef TextureNameMap::iterator TextureIterator;

private:

	/// Managed texture map
	TextureNameMap _texturesByName;

	std::string _rootPath;

};

} // namespace graphics
} // namespace dw

#endif // !DW_GRAPHICS_TEXTUREMANAGER_H
